{% extends "base.html" %}
{% block title %}Searchasset{% endblock %}
{% block content %}
<!--查詢信息-->
<form action="/searchassetinfo/" method="post" name="searchassetinfo">
    {% csrf_token %}
    <div><p><span>请购人：</span><input type="text" name="Requisitioner"></div>
    <div><p><span>请购部门：</span><input type="text" name="Department"></div>
    <div><p><span>单据号：</span><input type="text" name="Document_No"></div>
    <div><p><span>请购物资/固定资产：</span><input type="text" name="Materials"></div>
    <div><button type="submit">查询</button></div>
</form>
<div>
    <table border="1"  style="white-space : nowrap">
        <tr>
            <td>ID</td>
            <td>是否完成</td>
            <td>需求来源</td>
            <td>单据号</td>
            <td>采购订单号</td>
            <td>请购日期</td>
            <td>请购物资/固定资产</td>
            <td>请购部门</td>
            <td>请购人</td>
            <td>请购数量</td>
            <td>请购用途</td>
            <td>采购订单生成时间</td>
            <td>采购员</td>
            <td>超长原因说明</td>
            <td>供应商</td>
            <td>预计到货时间（采购回复）</td>
            <td>预计到货时间（供应商回复）</td>
            <td>实际到货时间（一）</td>
            <td>实际到货数量（一）</td>
            <td>实际到货时间（二）</td>
            <td>实际到货数量（二）</td>
            <td>实际到货时间（三）</td>
            <td>实际到货数量（三）</td>
            <td>未到数量</td>
            <td>是否超期</td>
            <td>超期时间</td>
            <td>备注</td>
        </tr>
        {% for searchassetinfo in searchassetinfo %}
        <tr>
            <td>{{ searchassetinfo.id }}</td>
            <td>{{ searchassetinfo.Finish }}</td>
            <td>{{ searchassetinfo.Source }}</td>
            <td>{{ searchassetinfo.Document_No }}</td>
            <td>{{ searchassetinfo.Order_No }}</td>
            <td>{{ searchassetinfo.Requisition_date }}</td>
            <td>{{ searchassetinfo.Materials }}</td>
            <td>{{ searchassetinfo.Department }}</td>
            <td>{{ searchassetinfo.Requisitioner }}</td>
            <td>{{ searchassetinfo.Requisition_Num }}</td>
            <td>{{ searchassetinfo.Requisition_purpose }}</td>
            <td>{{ searchassetinfo.Order_Time }}</td>
            <td>{{ searchassetinfo.Purchaser }}</td>
            <td>{{ searchassetinfo.Reason }}</td>
            <td>{{ searchassetinfo.Supplier }}</td>
            <td>{{ searchassetinfo.Arrival_time1 }}</td>
            <td>{{ searchassetinfo.Arrival_time2 }}</td>
            <td>{{ searchassetinfo.Actual_time1 }}</td>
            <td>{{ searchassetinfo.Actual_Num1 }}</td>
            <td>{{ searchassetinfo.Actual_time2 }}</td>
            <td>{{ searchassetinfo.Actual_Num2 }}</td>
            <td>{{ searchassetinfo.Actual_time3 }}</td>
            <td>{{ searchassetinfo.Actual_Num3 }}</td>
            <td>{{ searchassetinfo.Unarrival_Num }}</td>
            <td>{{ searchassetinfo.Overdue }}</td>
            <td>{{ searchassetinfo.Overdue_time }}</td>
            <td>{{ searchassetinfo.Remarks }}</td>
            {% endfor %}
    </table>
</div>
<!--
{% for searchassetinfo in searchassetinfo %}
<div class="form-list">
    <p><span>需求来源： </span><input type="text" value="{{ searchassetinfo.Finish }}" name="Source" placeholder="不超过300个字符"></p>
</div>
{% endfor %}
-->
{% endblock %}
{% block custome_js %}
<!-- JS表单验证 -->
<script type="text/javascript">
    function check() {
        var form = document.getElementById('form'); // 获得form表单的id
        var Requisitioner = form.Requisitioner.value.replace(/(^\s*)|(\s*$)/g, ""); // 过滤左右的空格
        var Department = form.Department.value.replace(/(^\s*)|(\s*$)/g, ""); // 过滤左右的空格
        var Document_No = form.Document_No.value.replace(/(^\s*)|(\s*$)/g, ""); // 过滤左右的空格
        var Materials = form.Materials.value.replace(/(^\s*)|(\s*$)/g, ""); // 过滤左右的空格

        if (Requisitioner.length == 0 && Department.length == 0 && Document_No.length == 0 && Materials == 0) {
            document.getElementById("result").innerHTML="账号和密码都不能为空";
            return false; // 返回假
        }else{
            document.getElementById("result").innerHTML="提交成功";
            return true; // 返回真
        }
    }
</script>
{% endblock %}